import ast
import json

import scrapy
import re


class Scr01(scrapy.Spider):
    name = 'scr02'
    start_urls=['https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_3']

    def parse(self, response):
        html=str(response.body_as_unicode())
        i=html.find('\"caseList\"')
        ii=html.find('\"dataSource\"')
        htmls=html[i+12:ii-2].encode('utf-8',errors='ignore').decode('unicode_escape').strip().replace('\"','\'')
        htmlstr=json.dumps(htmls,ensure_ascii=False).replace('\\','').replace('\'\'','0').strip('\n')
        htmla=json.dumps(htmlstr, ensure_ascii=False)[3:-3].replace('\'','\"')#.split('},')
        print(htmla)
